<?
    require_once 'core/controller.php';
    require_once 'core/library.php';
    require_once 'constant/mail.php';
    require_once 'constant/config.php';
    require_once 'core/mysql.php';
    require_once 'core/model.php';
    require_once 'function/function.php';

    if(isset($_GET['c']))
    {
        $controller = $_GET['c'];
    }
    else
    {
        $controller = 'Index';
    }

    if(isset($_GET["m"]))
    {
        $method =  $_GET['m'];
    }
    else
    {
        $method =  'index';
    }

    if(!(bool)file_exists('controllers/' . $controller . '.php'))
    {
        echo '<p class=\'error\'>Controller not existed.</p>';
        die();
    }

    require_once 'controllers/' . $controller . '.php';
    $object = new $controller;

    if (!(bool)in_array($method, get_class_methods($controller)))
    {
        echo '<p class=\'error\'>Method not existed in this controller.</p>';
        die();
    }

    $object->$method();
?>